package symbols;

import java.io.OutputStream;
import java.util.Hashtable;

public interface ISymbolTable {
	
	/**
	 * Add a symbol to the symbol table
	 * 
	 * @param <code>String</code> s
	 * @param symbol
	 */
	public void put(String s, ISymbol sym);
	
	/**
	 * Add many symbols at the same time
	 * @param t
	 
	public void putAll(ISymbolTable t);
	*/
	
	/**
	 * Add these symbols in the current scope
	 * (it could be parameters gathered somewhere else
	 * but belonging to this scope)
	 */
	public void addAllToScope(ISymbolTable t);
	
	/**
	 * Get all all symbols in this scope (only)
	 */
	public Hashtable getAllInScope();
	
	/**
	 * Get all symbols regardless of scope
	 * @return
	 */
	public Hashtable getAll();
	
	/**
	 * Get symbol table for parent scope
	 * @return symbol table for parent scope of null
	 */
	public ISymbolTable getParent();
	
	/**
	 * Set the parent scope's symbol table
	 * @param parent scope symbol table
	 */
	public void setParent(ISymbolTable parent);
	
	/**
	 * @return the depth in scope ; 0 if this table represents the global scope
	 */
	public int getDepth();
	
	/**
	 * @return the scope name of this symbol table (aka function name)
	 */
	public String getName();
	
	/**
	 * 
	 * @param <code>String</code> s
	 * @return the symbol if it has been defined previously (regardless of scope)
	 */
	public ISymbol get(String s);
	
	/**
	 * @param <code>String</code> s
	 * @return the symbol if it has been defined previously in this scope
	 
	public ISymbol getInScope(String s);
	*/
	
	/**
	 * 
	 * @param <code>String</code> s
	 * @return the symbol if it has been defined previously (regardless of scope)
	 */
	public boolean contains(String s);
	
	/**
	 * Display to outputstream System.out by default
	 * Nice for debugging purposes
	 * 
	 */
	public void print();
	
	/**
	 * Display to outputstream
	 * Nice for debugging purposes
	 * 
	 */
	public void print(OutputStream out);

	/**
	 * Return a copy of the symbol table
	 * with the same identifiers but different
	 * memory locations
	 * @return
	 */
	public Object clone();
}
